<?php
if (!defined('__COLA_DIR__')) exit;
/**
 * Hello World
 * 
 * @author edikud
 * @package Widget
 * @version 1.0.1
 * @copyright Copyright (c) 2019 Cola (http://www.mcooo.com)
 * @license GNU General Public License 2.0
 */
class Plugin_HelloWorld implements Plugins_Interface
{
    /**
     * 激活插件方法,如果激活失败,直接抛出异常
     * 
     * @access public
     * @return void
     * @throws Plugins_Exception
     */
    public static function activate()
    {
		Helper::addPanel(Helper::addMenu('扩展菜单'), 'title', 'subTitle', './#', 'admin', false);
    }
    
    /**
     * 禁用插件方法,如果禁用失败,直接抛出异常
     * 
     * @static
     * @access public
     * @return void
     * @throws Plugins_Exception
     */
    public static function deactivate()
	{
		Helper::removePanel(Helper::removeMenu('扩展菜单'), './#');
	}
    
    /**
     * 获取插件配置面板
     * 
     * @access public
     * @param Form $form 配置面板
     * @return void
     */
    public static function config(Form $form)
    {
        /** 分类名称 */
        $name = new Form_Text('word', NULL, 'Hello World', _t('说点什么'));
        $form->addInput($name);
    }
	
    /**
     * 插件实现方法
     * 
     * @access public
     * @return void
     */
    public static function PLUG_End()
    {
        echo '<span class="message success">'
            . htmlspecialchars(Helper::options()->plugin('HelloWorld')->word)
            . '</span>';
    }
}
